﻿Imports System.ComponentModel
Imports DevExpress.XtraEditors
Imports DevExpress.Skins
Imports DevExpress.LookAndFeel
Imports DevExpress.UserSkins


Public Class Form1
    Sub New()
        InitSkins()
        InitializeComponent()

    End Sub

    Sub InitSkins()
        DevExpress.Skins.SkinManager.EnableFormSkins()
        DevExpress.UserSkins.BonusSkins.Register()
        UserLookAndFeel.Default.SetSkinStyle("DevExpress Style")

    End Sub

    Public Sub loadInPanelMain(ByVal u As UserControl)
        pnMain.Controls.Clear()
        pnMain.Controls.Add(u)
        u.Dock = DockStyle.Fill
    End Sub

    Function KiemTraTKNhanvien() As Boolean
        If Account.MaCV = 0 Then
            MsgBox("Bạn chưa đăng nhập")
            Return False
        ElseIf Account.MaCV = 2 Or Account.MaCV = 1 Then
            Return True
        End If
    End Function

    Private Sub iAbout_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles iAbout.ItemClick
        If KiemTraTKNhanvien() = False Then
            MsgBox(Account.MaCV)
            Return
        End If
        Dim u As New UC_QuanLyKhachHang
        loadInPanelMain(u)
    End Sub

    Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
        If KiemTraTKNhanvien() = False Then
            Return
        End If
        Dim u As New UC_Quanlyhanghoa
        loadInPanelMain(u)
    End Sub

    Private Sub BarButtonItem5_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem5.ItemClick
        If KiemTraTKNhanvien() = False Then
            Return
        End If
        Dim u As New UC_QuanLyBanAn
        loadInPanelMain(u)
    End Sub
    Sub add_UC_QL_DichVu()
        If KiemTraTKNhanvien() = False Then
            Return
        End If
        Dim u As New UC_QuanLyDichVu
        loadInPanelMain(u)
    End Sub
    Private Sub BarButtonItem6_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem6.ItemClick
        add_UC_QL_DichVu()
    End Sub

    Private Sub BarButtonItem9_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem9.ItemClick
        If Account.MaCV = 0 Or Account.MaCV = 2 Then
            MsgBox("Bạn chưa đăng nhập hoặc không có quyền truy cập")
            Return
        Else
            Dim u As New UC_QuanLyNhanVien
            loadInPanelMain(u)
        End If
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim u As New UC_Login
        loadInPanelMain(u)
        ' add_UC_QL_DichVu()
    End Sub

    Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
        If KiemTraTKNhanvien() = False Then
            Return
        End If
        Dim u As New UC_Matkhau
        loadInPanelMain(u)
    End Sub

    Private Sub BarButtonItem11_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem11.ItemClick
        MessageBox.Show("Liên hệ: ITDark.kool@gmail.com - 01679031662")
    End Sub

    Private Sub BarButtonItem10_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem10.ItemClick
        MessageBox.Show("Hiện tại chưa có hướng dẫn sử dụng nào !")
    End Sub

    Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
        Account.MaCV = 0
        Dim u As New UC_Login
        loadInPanelMain(u)

    End Sub

    Private Sub BarButtonItem7_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem7.ItemClick
        If KiemTraTKNhanvien() = False Then
            Return
        End If
        Dim f As New F_TKHangHoa
        f.ShowDialog
        'THong ke doanh thu
    End Sub

    Private Sub BarButtonItem8_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem8.ItemClick
        If KiemTraTKNhanvien() = False Then
            Return
        End If
        Dim f As New F_TKDoanhThu
        f.ShowDialog()
        'Thong ke hang hoa
    End Sub
End Class
